package com.maxd.respository;

import com.maxd.model.RequirementInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

public interface RequirementInfoRepository extends JpaRepository<RequirementInfo, Long>, JpaSpecificationExecutor<RequirementInfo> {

    @Transactional
    @Modifying
    @Query(value = "update requirement_info set status = :status, remark = IFNULL(:remark, remark), update_by = :updateBy where id = :id",nativeQuery = true)
    int updateStatus(@Param("id") Long id, @Param("status") String status, @Param("remark") String remark, @Param("updateBy") String updateBy);
}